<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">

<div th:replace="include/header::head"></div>

<div th:replace="include/teacher_navbar::navbar(${loginTeacher})"></div>

<div class="container">
	<h1>
		<img th:src="@{/static/img/exam-teacher.png}" /> 上机考试管理
	</h1>

	<table class="table table-striped table-bordered">
		<thead>
		<tr>
			<th class="span3">考试名称</th>
			<th class="span3">考试时间</th>
			<th>创建人</th>
			<th>上传试卷</th>
			<th>自动开始</th>
			<th>进行中</th>
			<th>已结束</th>
			<th>已归档</th>
			<th>已清理</th>
			<th>&nbsp;</th>
		</tr>
		</thead>
		<tbody>
		<th:block th:each="exam : ${examList}">
			<tr>
				<td th:text="${exam.name}"></td>
				<td th:text="${#dates.format(exam.time, 'yyyy-MM-dd HH:mm:ss')}"></td>
				<td th:text="${exam.teacherName}"></td>
				<td><i th:class="${exam.paper != null and exam.paper != '' ? 'icon-ok' : ''}"></i></td>
				<td><i th:class="${exam.isAutostart != null and exam.isAutostart ? 'icon-ok' : ''}"></i></td>
				<td><i th:class="${exam.isActive != null and exam.isActive ? 'icon-ok' : ''}"></i></td>
				<td><i th:class="${exam.isFinish != null and exam.isFinish ? 'icon-ok' : ''}"></i></td>
				<td><i th:class="${exam.isArchived != null and exam.isArchived ? 'icon-ok' : ''}"></i></td>
				<td><i th:class="${exam.isCleared != null and exam.isCleared ? 'icon-ok' : ''}"></i></td>
				<td>
					<th:block th:if="${exam.isActive != null and exam.isActive}">
						<a class="btn btn-primary" th:href="@{'/teacher/exam/finish/' + ${exam.id}}"><i class="icon-off"></i>停止考试</a>
					</th:block>
					<th:block th:if="${(exam.isCleared == null or !exam.isCleared) and exam.isFinish != null and exam.isFinish}">
						<a class="btn" target="_blank" title="打包下载答卷" th:href="@{'/teacher/exam/zip/' + ${exam.id}}"><i class="icon-download-alt"></i></a>
						<a class="btn" target="_blank" title="导出提交记录" th:href="@{'/teacher/exam/export/' + ${exam.id}}"><i class="icon-book"></i></a>
					</th:block>
					<th:block th:if="${config.candelete}">
						<th:block th:if="${(exam.isCleared == null or !exam.isCleared) and exam.isArchived != null and exam.isArchived}">
							<a class="btn" th:href="@{'/teacher/exam/clear/' + ${exam.id}}"><i class="icon-remove-sign"></i> 清理</a>
						</th:block>
						<th:block th:if="${exam.isCleared != null and exam.isCleared}">
							<a class="btn" th:href="@{'/teacher/exam/delete/' + ${exam.id}}"><i class="icon-trash"></i> 删除</a>
						</th:block>
					</th:block>
				</td>
			</tr>
		</th:block>
		</tbody>
	</table>

</div>

<div th:replace="include/teacher_footer::footer"></div>

